import './assets/main.css'
import axios from 'axios'
import {createApp} from 'vue'

import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

const app = createApp(App)
app.use(router)
app.use(ElementPlus)

axios.interceptors.request.use(config => {
    const user = localStorage.getItem('user')
    if (user) {
        const {loginToken} = JSON.parse(user)
        if (loginToken) {
            config.headers['login_token_key'] = loginToken
        }
    }
    return config
}, error => Promise.reject(error))

app.mount('#app')
